<table>
  <tr>
    <th <%= sort_td_class_helper "questionnaire" %>><%= sort_link_helper "Questionnaire", "questionnaire" %></th>
    <th <%= sort_td_class_helper "youth_id" %>><%= sort_link_helper "Youth ID", "youth_id" %></th>
    <th <%= sort_td_class_helper "data_collection" %>><%= sort_link_helper "Data collection", "data_collection" %></th>
    <th <%= sort_td_class_helper "last_event" %>><%= sort_link_helper "Last event", "last_event" %></th>
    <th <%= sort_td_class_helper "comment" %>><%= sort_link_helper "Comment", "comment" %></th>
  </tr>

  <% @questionnaires.each do |q| %>
    <tr class="<%= get_next_result_set_type %>">
      <td><%= link_to(q.questionnaire_name.name, :action => 'edit', :id => q.id) %></td>
      <td><%= link_to(sprintf("%03d", q.data_collection.youth_id), :controller => 'youth', :action => 'edit', :id => q.data_collection.youth_id) %></td>
      <td><%= link_to(q.data_collection.data_collection_type.name, :controller => 'data_collection', :action => 'edit', :id => q.data_collection.id) %></td>
      <td><%= q.questionnaire_events.last.nil? ? "" : q.questionnaire_events.last.questionnaire_event_type.name %></td>
      <td><%= q.questionnaire_events.last.nil? ? "" : q.questionnaire_events.last.comment %></td>
    </tr>
  <% end %>
</table>
